intra-doc links: Resolve modules in type namespace

This commit is contained in:
Manish Goregaokar 2020-07-17 11:04:31 -07:00
parent 3014f23ddd
commit fe98de2a8e

View file

@ -584,23 +584,16 @@ 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@"]
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@",
]
} else if let Some(prefix) =
["const@", "static@", "value@", "function@", "fn@", "method@"]
.iter()
.find(|p| link.starts_with(**p))
{