-
Notifications
You must be signed in to change notification settings - Fork 14k
Description
Similar to #52545, rustdoc doesn't see anything if it's not written into a module's scope. However, there are some things that can be written in function/expression scope that still make it out into the public API. While that issue was about trait impls, it seems that inherent impls work in a similar way. Consider the following snippet:
fn asdf() {
impl SomeStruct {
pub fn qwop(&self) {
println!("hidden function");
}
}
}
fn main() {
let asdf = SomeStruct;
asdf.qwop(); // prints "hidden function"
}Even though qwop() was written in function scope, it's still visible globally because it was defined with pub. Rustdoc should collect these impls and display them.
One thing i'm curious about is whether we should show non-pub functions defined in non-module scope when --document-private-items is set. I think we can get away with it, because it already displays private functions there regardless of where they're defined.