-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rustdoc link with module@ does not link to the module #62830
Comments
Workaround: leverage rustc's name resolution instead of rustdoc's. dtolnay/syn@ae1983c pub mod x {}
pub fn x() {}
/// [module@x]
///
/// [module@x]: crate::rustdoc_workaround::x_module
pub struct S;
// https://github.com/rust-lang/rust/issues/62830
mod rustdoc_workaround {
pub use crate::x::{self as x_module};
// ^^^^^^^^ no ambiguity with function
} |
This is coming directly from |
I think eventually we should switch rustdoc to using |
Yeah I don't know either. I'm not sure how that overlap works in resolve. @eddyb might? We could tweak the resolve resolution functions to force looking for modules. |
I don't know much about name resolution, you want @petrochenkov. Only thing I know is that it should be possible to get a |
@eddyb the problem is that modules seem to be special and exist in all namespaces but also overlap. Do you have an idea of how that works? |
"Modules count as all three" sounds wrong? Modules live in the type namespace last I checked. |
Oh! Maybe we should just switch modules to being a type then, I was under the impression they lvied in all namespaces |
And yeah, seems like types cannot overlap with modules. |
Wait I'm confused - I thought functions are in the type namespace? Are they values instead? |
Functions are values |
Starting with an ambiguous lib.rs:
rustdoc correctly reports the ambiguity and suggests the possible resolutions:
In this case I want to link to the module so let's update lib.rs:
cargo doc
accepts this without warnings but the generated html file contains:I would expect [module@x] to link to the module x, not the function x.
Mentioning tracking issue: #43466
The text was updated successfully, but these errors were encountered: