Pre-RFC: Stable rustdoc URLs

Ooooh, that is nasty. Even with all private fields, this code compiles:

mod foo {
    pub struct Foo {
        field: i32,
    }
}
use foo::Foo;

fn fooer(foo: foo::Foo) {
    let Foo { .. } = foo;
}

and thus Foo can't be changed into an enum without breaking compilation. (It can be changed into a tuple-like struct, though, oddly enough?) I haven't thought of an example that prevents union->struct or union->enum though. And even enum->struct might be possible if the enum's variants were all #[doc(hidden)].

Regardless, at the very least, it's clearly compatible to switch an item from any concrete type into a pub use or a type alias to that type. So we definitely need this RFC for something, and it doesn't seem especially valuable to try to preserve the URL naming distinction between struct, enum, and union.

1 Like