Skip to content

Commit

Permalink
Fix outdated code
Browse files Browse the repository at this point in the history
  • Loading branch information
jyn514 committed Aug 6, 2020
1 parent ef54cde commit d240490
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/librustdoc/passes/collect_intra_doc_links.rs
Expand Up @@ -767,8 +767,6 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
// Disallow e.g. linking to enums with `struct@`
if let Res::Def(kind, id) = res {
debug!("saw kind {:?} with disambiguator {:?}", kind, disambiguator);
// NOTE: this relies on the fact that `''` is never parsed as a disambiguator
// NOTE: this needs to be kept in sync with the disambiguator parsing
match (self.kind_side_channel.take().unwrap_or(kind), disambiguator) {
| (DefKind::Const | DefKind::ConstParam | DefKind::AssocConst | DefKind::AnonConst, Some(Disambiguator::Kind(DefKind::Const)))
// NOTE: this allows 'method' to mean both normal functions and associated functions
Expand All @@ -780,7 +778,7 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
| (_, None)
// All of these are valid, so do nothing
=> {}
(_, Some(Disambiguator::Kind(expected))) if kind == expected => {}
(actual, Some(Disambiguator::Kind(expected))) if actual == expected => {}
(_, Some(expected)) => {
// The resolved item did not match the disambiguator; give a better error than 'not found'
let msg = format!("incompatible link kind for `{}`", path_str);
Expand Down
6 changes: 3 additions & 3 deletions src/test/rustdoc/intra-link-trait-item.rs
@@ -1,10 +1,10 @@
// allow-tidy-line-length
// ignore-tidy-linelength
#![deny(broken_intra_doc_links)]

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

impl S {
Expand Down

0 comments on commit d240490

Please sign in to comment.