Description
Rustdoc looks in different namespaces for diagnostics: https://github.com/rust-lang/rust/blob/66a9cfadf89439ad3ea1b67b996c0a90ca4763bf/src/librustdoc/passes/collect_intra_doc_links.rs#L1569-L1572
So this is handled properly:
warning: unresolved link to `file::into_iter`
--> tmp.rs:1:6
|
1 | /// [type@file::into_iter]
| ^^^^^^^^^^^^^^^^^^^^ `file` is a macro, not a module or type, and cannot have associated items
However (after #76955), resolution_failure
only looks at other namespaces if there are multiple path segments. So https://github.com/rust-lang/rust/blob/66a9cfadf89439ad3ea1b67b996c0a90ca4763bf/src/librustdoc/passes/collect_intra_doc_links.rs#L1114 and https://github.com/rust-lang/rust/blob/66a9cfadf89439ad3ea1b67b996c0a90ca4763bf/src/librustdoc/passes/collect_intra_doc_links.rs#L1242-L1244 are still necessary, because they handle cases like value@file
and type@file
.
It would be nice to clean this up so that WrongNamespace
is only handled in one place, in resolution_failure
.
Originally posted by @jyn514 in #76955 (comment)