cargo-rdme icon indicating copy to clipboard operation
cargo-rdme copied to clipboard

Intralinks to identifiers that are re-exported do not work (the standard library does this a lot)

Open orium opened this issue 3 years ago • 0 comments

Intralinks do not resolve re-exports. This means that if you have

mod foo {
    pub mod bar {
        struct Bar {}
    }
}

pub use foo::bar;

you cannot have an intralink to crate::bar::Bar, because re-exports are not resolved by cargo-rdme.

This would be a reasonably acceptable limitation, if it wasn't a very common pattern in the standard library. For instance things defined in alloc are then re-exported in std, for instance, you cannot link to ::std::vec::Vec. This makes it a much more annoying limitation which deserves to be fixed.

Something that we need to support is crate imports with rename (again, a common pattern in the standard library). For instance, this is how std::vec comes to be:

extern crate alloc as alloc_crate;
⋮
pub use alloc_crate::vec;

This is independent from supporting use re-exports.

orium avatar Nov 07 '21 19:11 orium