Skip to content

Commit

Permalink
intra-doc links: Resolve modules in type namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Jul 17, 2020
1 parent 3014f23 commit fe98de2
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions src/librustdoc/passes/collect_intra_doc_links.rs
Original file line number Diff line number Diff line change
Expand Up @@ -584,25 +584,18 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
let (res, fragment) = {
let mut kind = None;
let mut disambiguator = None;
path_str = if let Some(prefix) = ["struct@", "enum@", "type@", "trait@", "union@"]
.iter()
.find(|p| link.starts_with(**p))
path_str = if let Some(prefix) =
["struct@", "enum@", "type@", "trait@", "union@", "module@", "mod@"]
.iter()
.find(|p| link.starts_with(**p))
{
kind = Some(TypeNS);
disambiguator = Some(&prefix[..prefix.len() - 1]);
link.trim_start_matches(prefix)
} else if let Some(prefix) = [
"const@",
"static@",
"value@",
"function@",
"mod@",
"fn@",
"module@",
"method@",
]
.iter()
.find(|p| link.starts_with(**p))
} else if let Some(prefix) =
["const@", "static@", "value@", "function@", "fn@", "method@"]
.iter()
.find(|p| link.starts_with(**p))
{
kind = Some(ValueNS);
disambiguator = Some(&prefix[..prefix.len() - 1]);
Expand Down

0 comments on commit fe98de2

Please sign in to comment.