diff options
| author | Yuki Okushi <jtitor@2k36.org> | 2021-07-13 08:54:38 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-13 08:54:38 +0900 |
| commit | 15af98d0700a340eaef8d44de58edb5f1a54b4d2 (patch) | |
| tree | 2461c954a27b1e5f422fe84b77ed3f363d35e76c /src/librustdoc | |
| parent | 4eba19a81381545db9e287b644809620667a150c (diff) | |
| parent | 3dab2d210f284ae9dcb6af657290b9e0a902c4bb (diff) | |
| download | rust-15af98d0700a340eaef8d44de58edb5f1a54b4d2.tar.gz rust-15af98d0700a340eaef8d44de58edb5f1a54b4d2.zip | |
Rollup merge of #87078 - fee1-dead:rustdoc, r=jyn514
Rustdoc: suggest removing disambiguator if linking to field This fixes #85615. `@rustbot` label T-rustdoc
Diffstat (limited to 'src/librustdoc')
| -rw-r--r-- | src/librustdoc/passes/collect_intra_doc_links.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index 44a3faf6f7b..21bd3ebd21b 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -1610,6 +1610,8 @@ impl Disambiguator { return Suggestion::Macro; } else if kind == DefKind::Fn || kind == DefKind::AssocFn { return Suggestion::Function; + } else if kind == DefKind::Field { + return Suggestion::RemoveDisambiguator; } let prefix = match kind { @@ -1674,6 +1676,8 @@ enum Suggestion { Function, /// `m!` Macro, + /// `foo` without any disambiguator + RemoveDisambiguator, } impl Suggestion { @@ -1682,6 +1686,7 @@ impl Suggestion { Self::Prefix(x) => format!("prefix with `{}@`", x).into(), Self::Function => "add parentheses".into(), Self::Macro => "add an exclamation mark".into(), + Self::RemoveDisambiguator => "remove the disambiguator".into(), } } @@ -1691,6 +1696,7 @@ impl Suggestion { Self::Prefix(prefix) => format!("{}@{}", prefix, path_str), Self::Function => format!("{}()", path_str), Self::Macro => format!("{}!", path_str), + Self::RemoveDisambiguator => path_str.into(), } } } |
