I'm not sure consensus agrees with that. Documenting private APIs is a good practice but depending more heavily on doctests than unit tests for private APIs seems weird to me. Personally, I look for examples in documentation for public APIs, like most developers, but I don't expect to find them for private APIs. Primarily because accessing private API documentation requires jumping through some hoops for open-source projects. (See below for more on this.) If I want to find out how to use private APIs, I first look for unit tests. And failing that I will grep the codebase.
Unit tests already have the capability of testing private methods and functions, and they can generally be more thorough in what they test about the API compared to a small code example in documentation. Aren't unit tests the right tool for the job?
As far as I am aware, doctests are not intended to test private APIs at all. So yes, that is the current state of things as I understand it.
Best practice is to use unit tests.
In my experience, and as far as I know from code I've seen and worked on that is written by others, code examples don't have to appear in doctests for private APIs because they already appear in unit tests. Docs for private APIs are almost always slim anyway, because tools like docs.rs will generate only public API documentation. So that's really all there is to look at. AFAIK, there is no way to get docs.rs to generate documentation with private items.
Just getting cargo doc
to output any documentation for private items requires a special CLI flag. I suspect few people bother doing this locally. Maybe in CI? I don't know of any examples in the wild.
In other words, private API documentation of any kind is probably uncommon because there is some friction in the ecosystem.
It seems unusual that you would expect the visibility of functions and methods to change frequently enough for this to be a major concern. (With such an unstable API, wouldn't you want to limit how much effort goes into documenting internals?) But I think the same conclusion probably holds; the unit tests are functional examples, even if they don't appear in documentation.
All that said, I have no visibility into rustdoc. The best I can do is basically the same as you can: Search for existing open issues to find out what the status may be, if any. This one is relevant: Private doc test flag ¡ Issue #60820 ¡ rust-lang/rust (github.com) The last reply to that thread links back to other relevant threads on this forum.
So, it seems you are not alone but there has been little effort to address this shortcoming. If I had to guess, that is probably because unit tests are adequate and more capable than doctests.