RawVec and Unique available but not documented?

RawVec and Unique are used internally in the implementation of, for example, Vec. They would be tremendously useful for implementing other container structures. As far as I can see from the liballoc source on GitHub, they are exported by their respective modules and can be imported also in user code (not just Rust developer code). The documentation, however, is explicitly hidden using #![doc(hidden)]. I'd like to understand the rationale.

The PR that made raw_vec public has the rationale: Make the public API of the alloc crate a subset of std by SimonSapin · Pull Request #51569 · rust-lang/rust · GitHub

Thanks. That's a bit over my head. Do I read it right that the reason is that it's unstable and likely to stay that way semi-permanently, so people shouldn't be encouraged to use it?

If it isn't documented, don't use it. #[doc(hidden)] is a tool for making things effectively private, in cases where they must be public only for technical reasons (e.g. if macros use them). I wouldn't consider these stability annotations to have any bearing at all on whether they can be used forward-compatibly by downstream code.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.