Std::fmt vs collections::fmt

The bug report https://github.com/rust-lang/rust/issues/30477 brought up the issue that in beta and nightly, the docs for std::fmt aren’t available anymore using the std/fmt url prefix, but rather they’re in collections now. This seems a rather unfortunate and accidental change. Several questions arise from this: Should the pub mod fmt; line be removed from libcollections/lib.rs? That would, afaict, lead to a situation where at least they won’t show up in the docs in confusing places anymore. Would that be a change that breaks anything? How would we export fmt from libstd to make sure we break nothing and the docs are available again?

I thank steveklabnik (who suggested I start this discussion here), panicbit, bluss, aatch, and ubsan (and anyone I might’ve forgotten) to help illuminate this issue to me on irc.

1 Like

https://github.com/rust-lang/rust/issues/30213 has more context

I can’t reproduce, std::fmt is present and the links to formatting traits work

Looks like you’re right, it was somehow fixed in nightly (tho the docs are still also exported via https://doc.rust-lang.org/nightly/collections/fmt/index.html, which is probably confusing). The original behaviour I described is still observable on beta.

collections::fmt is just the implementation behind the façade, just like collections::vec is for std::vec though.

Yes, that much is clear to me - but having the docs show up in multiple places (also when keyword searching) seems confusing?

It is. We were also discussing on IRC yesterday that it’s confusing that the compiler sometimes emits type names with core:: or collections::, e.g. https://github.com/rust-lang/rust/issues/25852

We turned off compiler internals docs a while ago, and it seems like it would make sense to do the same for everything but libstd.

libcore is stable now which makes that a bit weird, but maybe its docs should be segregated off to the side?

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